package com.axx.android.home.activity;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.axx.android.R;
import com.axx.android.home.model.UserList;
import com.axx.android.utils.ImageLoader;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import static android.R.attr.data;

/**
 * Created by Administrator on 2017/8/1 0001.
 */

public class UserAdapter extends BaseQuickAdapter<UserList.UserListBean, BaseViewHolder> {
    public UserAdapter(@LayoutRes int layoutResId, @Nullable List<UserList.UserListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, UserList.UserListBean item) {
        helper.setText(R.id.tv_name, item.getNickName());
        ImageLoader.loadRoundImage(item.getHeadPic(), (ImageView) helper.getView(R.id.iv_header), mContext);
        helper.setText(R.id.tv_distance, item.getDistance() + "km");

        helper.setImageResource(R.id.view_sex,"M".equals(item.getSex())?R.drawable.ic_sex_man:R.drawable.ic_sex_woman);
    }
}
